Skip to content

[#52] Sync → Ignore patterns - #70

Open
kwame-Owusu wants to merge 16 commits into
8thpark:mainfrom
kwame-Owusu:feat/ignore-patterns
Open

[#52] Sync → Ignore patterns#70
kwame-Owusu wants to merge 16 commits into
8thpark:mainfrom
kwame-Owusu:feat/ignore-patterns

Conversation

@kwame-Owusu

@kwame-Owusu kwame-Owusu commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Resolves #52

Feature

There's no way to exclude a folder or file pattern from sync, every file the vault reader sees becomes a candidate for push or pull. Users will want to keep some folders local only (a private notes folder, a large attachments folder) without excluding them from Obsidian entirely.

Needs a settings field for glob style ignore patterns, applied before takeSnapshot/planSync ever sees those paths.

Changes

Added the ability to exclude files and folders from sync via two layers:

  1. Built-in local_ convention, any path segment starting with local_ is always excluded from sync, no configuration needed
  2. User-configurable glob patterns, stored in settings, editable via a textarea in the Sync section of the settings tab. Supports * (any chars in segment), ** (any depth), ? (single char)
    Filtering happens at the vault reader level so ignored files never enter the snapshot system. Previously-synced files that become ignored will appear as deletions and be cleaned from remote on next sync.

UI

Look of the UI in the settings tab for geod, users will be able to add their glob style patterns line by line. Similar to how we do in a .gitignore file.

image

Tests

Added new tests in ignore.test.ts, and they all pass

Greptile Summary

This PR adds two-layer ignore filtering to the vault reader: a built-in local_ prefix convention and user-configurable glob patterns stored in settings and exposed via a new Sync section in the settings tab. Filtering happens at the createObsidianReader level so ignored files never enter the snapshot or sync planning pipeline.

  • src/ignore.ts provides hasLocalPrefix, globToRegex, shouldIgnore, and pre-compilation helpers (compilePatterns, shouldIgnoreCompiled); all are well-tested in src/ignore.test.ts.
  • Settings normalization safely coerces missing or malformed ignorePatterns to [], and settingsEqual is extended for array comparison; previously-flagged UI bugs in renderSyncSection are resolved in this revision.
  • All createObsidianReader call sites in main.ts and the integration test pass the live ignorePatterns, so patterns take effect on the next sync immediately after save.

Confidence Score: 5/5

  • Safe to merge — the filtering logic is pure and well-tested, settings migration is backwards-compatible, and all reader call sites are updated correctly.
  • The glob engine, normalization, and UI wiring are all correct. The only finding is a missing blank line between two top-level function definitions in settings.ts, which has no runtime impact.
  • No files require special attention.

Important Files Changed

Filename Overview
src/ignore.ts New module implementing glob matching and the built-in local_ prefix convention. compilePatterns/shouldIgnoreCompiled are correctly exported for efficient pre-compiled use; shouldIgnore now delegates through them.
src/ignore.test.ts Comprehensive table-driven tests covering hasLocalPrefix, matchesGlob, and shouldIgnore. Edge cases like empty path, empty pattern, ** in middle, and leading slash stripping are all exercised.
src/settings/settings.ts Adds ignorePatterns: string[] field with default, normalization, and equality support. Minor style issue: missing blank line between arraysEqual and saveDraft comment, inconsistent with the rest of the file.
src/settings/tab.ts New renderSyncSection adds the Sync heading and a multiline textarea for ignore patterns. Previously flagged setDesc argument bug is resolved; description now correctly explains the local_ convention and the private/** folder idiom.
src/vault/obsidian.ts Adds ignorePatterns parameter to createObsidianReader and filters ignored paths before pushing to the result set. Filtering happens at read time, so ignored files never enter the snapshot.
src/main.ts All createObsidianReader call sites updated to pass this.settings.ignorePatterns. Because settings are updated synchronously by saveDraft, patterns take effect on the next sync without any additional refresh step.
src/settings/settings.test.ts New cases verify normalization (missing, non-array, non-string elements) and equality for ignorePatterns. Coverage is appropriate.
src/sync/sync.itest.ts Updated to pass liveSettings.ignorePatterns (defaults to []) to createObsidianReader. No logic changes.
styles.css Adds .geode-sync-anchor margin rule consistent with the existing .geode-support-anchor style.

Reviews (11): Last reviewed commit: "Merge branch 'main' into feat/ignore-pat..." | Re-trigger Greptile

Context used:

  • Context used - .agents/skills/typescript-as-go/SKILL.md (source)
  • Context used - AGENTS.md (source)

Comment thread src/ignore.ts
Comment thread src/settings/tab.ts
Comment thread src/settings/tab.ts
@revett revett changed the title Feat: ignore patterns Sync → Ignore patterns Jul 17, 2026
@revett

revett commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

@kwame-Owusu Thanks for the PR, will leave this for after the v0.1.0 release to merge.

@kwame-Owusu

Copy link
Copy Markdown
Contributor Author

@kwame-Owusu Thanks for the PR, will leave this for after the v0.1.0 release to merge.

Cool 👍

@revett revett changed the title Sync → Ignore patterns [#52] Sync → Ignore patterns Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignore patterns for excluded files and folders

2 participants